home *** CD-ROM | disk | FTP | other *** search
/ Amiga Inside! / Amiga FD Inside (1995)(Ultramax).iso / forumamiga / programme / dynamicnodes / test.c < prev    next >
C/C++ Source or Header  |  1994-07-29  |  3KB  |  103 lines

  1. /**
  2.  **  Check out DynamicNode routines ;-)
  3.  **  Holgi (29-Jul-94) width MaxonC
  4.  **
  5.  **  Tabsize = 3
  6.  **/
  7.  
  8. #include <exec/types.h>
  9. #include <pragma/exec_lib.h>
  10. #include <pragma/gadtools_lib.h>
  11. #include <pragma/intuition_lib.h>
  12. #include <intuition/gadgetclass.h>
  13.  
  14. #include "DynamicNodes.h"
  15.  
  16. struct Library       *GadToolsBase;
  17. struct Library       *IntuitionBase;
  18.  
  19. struct Screen        *MyScr;
  20. struct DrawInfo      *MyDrInfo;
  21. struct VisualInfo   *VisualInfo;
  22. struct Gadget          *FooGG;
  23. struct IntuiMessage *IMsg;
  24. struct Window        *MyWin;
  25. struct List              MyList;
  26.  
  27. struct Gadget          *GGList  = NULL;
  28. STRPTR                  FileName = "S:User-Startup";
  29.  
  30. void main( void );
  31. void wbmain( struct WBStartup *ws ) { main(); }
  32.  
  33. void main( void )
  34. {
  35.     if( GadToolsBase = OpenLibrary( "gadtools.library", 36 ))
  36.     {
  37.         if( IntuitionBase = OpenLibrary( "intuition.library", 36 ))
  38.         {
  39.             if( LoadTextNodes( FileName, &MyList ))
  40.             {
  41.                 if( MyScr = LockPubScreen( NULL ))
  42.                 {
  43.                     MyDrInfo = GetScreenDrawInfo( MyScr );
  44.                     if( VisualInfo = GetVisualInfoA( MyScr, NULL ))
  45.                     {
  46.                         if( FooGG = CreateContext( &GGList ))
  47.                         {
  48.                             struct NewGadget MyNewGG = {
  49.                                 MyScr->WBorLeft, MyScr->BarHeight + 1,
  50.                                 (MyDrInfo->dri_Font->tf_XSize << 5) + 14,
  51.                                 ((MyDrInfo->dri_Font->tf_YSize + 1) << 3) + 4,
  52.                                 NULL, MyScr->Font, 0, 0, VisualInfo, NULL
  53.                             };
  54.                             struct TagItem MyGGTags[] = {
  55.                                 GTLV_Labels,(ULONG) &MyList, GTLV_ReadOnly,TRUE,
  56.                                 GTLV_ScrollWidth,(MyDrInfo->dri_Font->tf_XSize << 1) + 2,
  57.                                 LAYOUTA_Spacing,1, TAG_DONE,0
  58.                             };
  59.                             if( CreateGadgetA( LISTVIEW_KIND, FooGG, &MyNewGG, MyGGTags ))
  60.                             {
  61.                                 struct TagItem MyWinTags[] = {
  62.                                     WA_IDCMP,IDCMP_CLOSEWINDOW | LISTVIEWIDCMP,
  63.                                     WA_Gadgets,(ULONG) GGList, WA_Title,(ULONG) FileName,
  64.                                     WA_DragBar,TRUE, WA_DepthGadget,TRUE, WA_CloseGadget,TRUE,
  65.                                     WA_NoCareRefresh,TRUE, WA_Activate,TRUE, WA_RMBTrap,TRUE,
  66.                                     WA_SmartRefresh,TRUE, WA_AutoAdjust,TRUE,
  67.                                     WA_InnerWidth,MyNewGG.ng_Width,
  68.                                     WA_InnerHeight,MyNewGG.ng_Height,
  69.                                     WA_PubScreen,(ULONG) MyScr, TAG_DONE,0
  70.                                 };
  71.                                 if( MyWin = OpenWindowTagList( NULL, MyWinTags ))
  72.                                 {
  73.                                     BOOL Finished = FALSE;
  74.     
  75.                                     GT_RefreshWindow( MyWin, NULL );
  76.                                     while( !Finished )
  77.                                     {
  78.                                         WaitPort( MyWin->UserPort );
  79.                                         while( IMsg = GT_GetIMsg( MyWin->UserPort ))
  80.                                         {
  81.                                             if( IMsg->Class == IDCMP_CLOSEWINDOW )
  82.                                                 Finished = TRUE;
  83.                                             GT_ReplyIMsg( IMsg );
  84.                                         }
  85.                                     }
  86.                                     CloseWindow( MyWin );
  87.                                 }
  88.                             }
  89.                             FreeGadgets( GGList );
  90.                         }
  91.                         FreeVisualInfo( VisualInfo );
  92.                     }
  93.                     FreeScreenDrawInfo( MyScr, MyDrInfo );
  94.                     UnlockPubScreen( NULL, MyScr );
  95.                 }
  96.                 FreeList( &MyList );
  97.             }
  98.             CloseLibrary( IntuitionBase );
  99.         }
  100.         CloseLibrary( GadToolsBase );
  101.     }
  102. }
  103.